package com.lrs.java.j2se_self.ioReview;
import java.io.*;
public class TestDataStream {
	public static void main(String[] agrs){
		ByteArrayOutputStream bos  = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(bos);
		try{
			dos.writeBoolean(true);
			dos.writeDouble(Math.random());
			dos.writeLong(221L);
			ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
			System.out.println("in all there is "+bis.available() +" words can be resolve");
			DataInputStream dis = new DataInputStream(bis);
			System.out.println(dis.readBoolean());
			System.out.println(dis.readDouble());
			System.out.println(dis.readLong());
			dos.close();dis.close();
		}catch(IOException e){
			e.printStackTrace();
		}
	}
}
